<template>
	<view>
		<view>
			<view style="border-radius: 20rpx;width: 690rpx;margin-left: 10rpx;margin-top: 20rpx;background-color: #ffffff;padding: 20rpx;" v-for="(item,index) in userlist" :key='index'>
				<view class="name" style="font-weight: bold;margin-top: 0rpx;font-size: 50rpx;width: 100rpx;" @tap="openupdata(item.id)">...</view>
				<view class="name" style="margin-top: 40rpx;">用户账号: {{item.phone}}</view>
				<view class="name">用户昵称：{{item.name}}</view>
				<view class="name">代理设备：{{item.self_equ}}</view>
				<view class="name">状态：开启</view>
				<view class="name">创建时间：{{item.time}}</view>
			</view>
			<!-- <view style="border-radius: 20rpx;width: 690rpx;margin-left: 10rpx;margin-top: 20rpx;background-color: #ffffff;padding: 20rpx;">
				<view class="name" style="font-weight: bold;margin-top: 0rpx;font-size: 50rpx;width: 100rpx;" @tap="openupdata"></view>
				<view class="name" style="margin-top: 40rpx;">用户账号: 15766618278</view>
				<view class="name">用户昵称：111</view>
				<view class="name">代理设备：50</view>
				<view class="name">状态：开启</view>
				<view class="name">创建时间：2023-11-24</view>
			</view> -->
			
			
			<view class="box-img" v-if="showupdata" @tap="conealImg"></view>
			
			<view class="updataview" v-if="showupdata">
				<view class="showview" style="margin-top: 20rpx;" @tap="goteams">修改</view>
				<view class="showview" @tap="gonewequipment">管理设备</view>
				<view class="showview" @tap="reset">重置密码</view>
				<view class="showview" @tap="conealImg">取消</view>
			</view>
		</view>
	</view>
</template>

<script>

	export default {
		data() {
			return {
				userlist:[],
				showupdata:false,
				userid:''
			}
		},
		onLoad(){
			this.getUserinfo();
		},
		
		methods: {
			getUserinfo(){
				let userinfo = uni.getStorageSync('userinfo');
				uni.showLoading({
					title:"加载中"
				})
				
				this.$api.interfaceApi('getusermanage')({
					'uid': userinfo.id,
					//'admin':App.globalData.sys
				}).then(res=>{
					uni.hideLoading()
					this.userlist = res.data
				})
			},
			conealImg(){
				this.showupdata = false
			},
			openupdata(getid){
				this.userid = getid
				this.showupdata = true
			},
			goteams(){
				uni.navigateTo({
					url:'/pages/my/updatainfo?uid='+this.userid
				})
			},
			gonewequipment(){
				uni.navigateTo({
					url:'/pages/equipment/newequipment?uid='+this.userid
				})
			},
			reset(){
				
				this.$api.interfaceApi('resetpassword')({
					'uid': this.userid,
					//'admin':App.globalData.sys
				}).then(res=>{
					uni.showToast({
						title:'密码重置为888888',
						icon:true
					})
				})
			}
		}
	}
</script>

<style>
	.showview{
		margin-top: 60rpx;
		margin-bottom: 60rpx;
	}
	.box-img{
			position: fixed;
			top: 0;
			left: 0;
			width: 100%;
			height: 100%;
			background-color:#000000;
			opacity: 0.5;
			z-index: 99;
		}
	.updataview{
		background-color: #FFFFFF;
		border-radius: 40rpx 40rpx 0rpx 0rpx;
		width: 100%;
		height: 450rpx;
		position: absolute;
		top: 65%;
		/* left: 10%; */
		z-index: 100;
		padding: 20rpx;
		box-sizing: border-box;
		text-align: center;
		font-size: 34rpx;
	}
	.name{
		margin-top: 20rpx;
		margin-left: 10rpx;
	}
</style>